﻿#include <iostream>
#include <deque>
#include <cctype>
using namespace std;

bool isPalindrome(string s) {
    deque<char> dq;
    for (char c : s) {
        if (isalnum(c)) dq.push_back(tolower(c));
    }

    while (dq.size() > 1) {
        if (dq.front() != dq.back()) return false;
        dq.pop_front();
        dq.pop_back();
    }
    return true;
}

int main() {
    string str = "A man, a plan, a canal: Panama";
    cout << (isPalindrome(str) ? "YES" : "NO") << endl;
    return 0;
}
